package com.fzkjjt.shardingjdbc.mapper;

import com.fzkjjt.shardingjdbc.entity.FzUserOrder;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @program: sharding-jdbc
 * @description:
 * @author: FangZhen
 * @create: 2021-04-29 10:45
 **/
@Mapper
public interface FzUserOrderMapper {

    @Insert("insert into fz_user_order(userid, ordernumber, create_time, yearmonth) values( #{userid}, #{ordernumber}, #{createTime}, #{yearmonth})")
    @Options(useGeneratedKeys = true, keyColumn = "orderid", keyProperty = "orderid")
    void addFzUserOder(FzUserOrder fzUserOrder);


    @Select("select * from fz_user_order limit #{pageNo}, 10")
    List<FzUserOrder> findUserOrders(@Param("pageNo") Integer pageNo);

    @Select("select count(1) from fz_user_order")
    int countUserOrders();
}
